﻿@using KRM.Web.Controllers
@{
    List<HomeController.TaskSnapShot> taskByUsers = ViewBag.TaskByUser;
}
<div class="row-fluid">
    <ul class="tabs tabs-inline tabs-top orderdetail-task-tabs">
        <li class="active">
            <a href="#today" data-toggle="tab">Today</a>
        </li>
        <li>
            <a href="#summary" data-toggle="tab">Summary</a>
        </li>
    </ul>
    <div class="tab-content padding tab-content-inline tab-content-bottom orderdetail-task-tabs-content">
        <div class="tab-pane active" id="today">
            <div class="row-fluid">
                <div class="span3">
                    <h4>Tasks by User</h4>
                </div>
                <div class="span3">
                    @Html.DropDownList("DepartmentId", null, new { @class = "input-block-level", onchange = "departmentchange(this.value)" })
                </div>
            </div>
            <div class="taskbyusers border-padding10">
                @foreach (var item in taskByUsers)
                {
                    var color = "black";
                    if (item.WorkRate < 20)
                    {
                        color = item.Total == 0 ? "green" : "red";
                    }
                    else if (item.WorkRate >= 20 && item.WorkRate < 40)
                    {
                        color = "Orange";
                    }
                    else if (item.WorkRate >= 40 && item.WorkRate < 60)
                    {
                        color = "green";
                    }
                    else if (item.WorkRate >= 60 && item.WorkRate < 80)
                    {
                        color = "blue";
                    }
                    else
                    {
                        color = "Violet";
                    }
                    <div class="border-padding10" style="border-color: @color">
                        <div class="row-fluid">
                            <div class="span1" style="background: @color"></div>
                            <div class="span3">
                                <strong>@item.UserName</strong><br />
                                @item.WorkRate %
                            </div>
                            <div class="span2">Assigned: @item.Total</div>
                            <div class="span2">Completed: @item.Completed</div>
                            <div class="span2">Created: @item.Created</div>
                            <div class="span2">Re-Assigned: @item.ReAssigned</div>
                        </div>
                    </div>
                }
            </div>
        </div>
        <div class="tab-pane" id="summary">
        </div>
    </div>
</div>
